<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>凉山州中考报名信息管理系统</title>
<link rel="stylesheet" href="../css/newStyle.css">
<link rel="stylesheet" type="text/css" href="../css/bwyStyle.css" />

<link href="../css/bootstrap.css" rel="stylesheet" />
<script src="../js/jquery-3.2.1.min.js"></script>
<script src="../city/js/bootstrap.js"></script>
<script src="../js/jquery.cxselect.min.js"></script>
</head>
<body>
	<form id="signup" class="form-inline" action="doUpdateSignUpStudent"
		method="post">
		<div class="container newmainBox ">
			<div class="row text-center">
				<div>
					<h1>凉山州中考报名信息填报(县市招办)</h1>
				</div>
			</div>
			<div class="row">
				<p class="tips" style="text-align: center;">本批次填报时间限制为：3月27日至4月5日</p>
			</div>
			<div class="clearfix visible-xs-block"></div>
			<div class="row">
				<div class="col-xs-12 col-md-12 text-right" style="cursor: pointer;">
					<a id="updataPassword" class="loginOut" onclick="is_submit(1)">[返回上级]</a>
					<a id="loginOut" class="loginOut" onclick="is_submit(2)">[安全退出]</a>
				</div>
			</div> 
			<div class="row">
				<div class="panel panel-success">
					<div class="panel-heading text-center">
						<h3 class="panel-title">基础信息</h3>
					</div>
				</div>
			</div>
			<div class="row">
				<div class="col-xs-2 col-md-2 text-right">
					<span>当前学生：</span>
				</div>
				<div class="col-xs-2 col-md-2" style="float: left">
					<input type="text" th:value="${stu.xm}" value="" name='xm'  onkeyup="this.value=this.value.replace(/[^\u4e00-\u9fa5]/g,'')"
						>
				</div>
				<div class="col-xs-2 col-md-2 text-right">
					<span>身份证号：</span>
				</div>
				<div class="col-xs-2 col-md-2" style="float: left">
					<input type="text"  value="" th:value="${stu.sfzh}" name="oldsfzh" id="oldsfzh" readonly="readonly" hidden="hidden">
					<input type="text"  value="" th:value="${stu.sfzh}" name="sfzh" onblur="getCsrq(this);" placeholder="输入新身份证" onKeyUp="value=value.replace(/[\W]/g,'')">
				</div>
				<div class="col-xs-2 col-md-2 text-right">
					<span>学籍号：</span>
				</div>
				<div class="col-xs-2 col-md-2" style="float: left">
					<input type="text"  value=""  th:value="${stu.xjh}" name="xjh" onKeyUp="value=value.replace(/[\W]/g,'')"
						>
				</div>
			</div>
			<div class="clearfix" style="margin-bottom: 10px;"></div>
			<div class="row">
				<div class="col-xs-2 col-md-2 text-right">
					<span>出生年月：</span>
				</div>
				<div class="col-xs-2 col-md-2" style="float: left">
					<input readonly="readonly" th:value="${stu.csrq}" style="background: #ccc;" type="text" value="" name="csrq"
						>
				</div>
				<div class="col-xs-2 col-md-2 text-right">
					<span>性别：</span>
				</div>
				<div class="col-xs-2 col-md-2" style="float: left">																					
					男：<input type="radio" th:checked="${stu.xb=='1'?'true':'false'}" value="1" name="xb">
					女：<input type="radio" th:checked="${stu.xb=='2'?'true':'false'}" value="2" name="xb">
				</div>
				<div class="col-xs-2 col-md-2 text-right">
					<span>民族：</span>
				</div>
				<div class="col-xs2 col-md-2" style="float: left">
					<!-- <input type="text" value="" name="mz"> -->
					
					<select id="mz" name="mz" style="width:146px;">
					</select>
					
				</div>
			</div>
			<div class="clearfix" style="margin-bottom: 10px;"></div>
			<div class="row">
				<div class="col-xs-2 col-md-2 text-right">
					<span>学校名称：</span>
				</div>
				<div class="col-xs-2 col-md-2" style="float: left">
					<input style="background: #ccc;" type="text" readonly="readonly" th:value="${stu.byzxdm}" name="byzxdm"
						>
				</div>
				<div class="col-xs-2 col-md-2 text-right">
					<span>班级名称：</span>
				</div>
				<div class="col-xs-2 col-md-2" style="float: left">
					<input type="text" th:value="${stu.bjdm}" value="" name="bjdm"
					onkeyup="this.value=this.value.replace(/\D/g,'')"	>
				</div>
				<!-- <div class="col-xs-2 col-md-2 text-right">
					<span>就读县市：</span>
				</div>
				 <div class="col-xs2 col-md-2" style="float: left">
					<input type="text" value="" name="jdd"
						>
				</div> -->
			</div>
			<div class="clearfix" style="margin-bottom: 10px;"></div>
			<div class="row">
				<div class="panel panel-primary">
					<div class="panel-heading text-center">
						<h3 class="panel-title">填报信息</h3>
					</div>
				</div>
			</div>
			<div class="row">
				<div class="col-xs-2 col-md-2 text-right">
					<label for="yzbm">邮政编码：</label>
				</div>
				<div class="col-xs-10 col-md-10" style="float: left">
					<input type="text"  th:value="${stu.yzbm}" maxlength="6" style="width: 100%"
						class="bg-success" id="homeaddress" placeholder="请输入邮政编码"
						name="yzbm" value="" onkeyup="this.value=this.value.replace(/\D/g,'')" />
				</div>
			</div>
			<div class="clearfix" style="margin-bottom: 10px;"></div>
			<div class="row">
				<div class="col-xs-2 col-md-2 text-right">
					<label for="txdz">通信地址：</label>
				</div>
				<div class="col-xs-10 col-md-10" style="float: left">
					<input type="text" th:value="${stu.txdz}" maxlength="250" style="width: 100%"
						class="bg-success" id="mailaddress" placeholder="请输入通信地址"
						name="txdz" value=""  onkeyup="value=value.replace(/[^\w\u4E00-\u9FA5]/g, '')"/>
				</div>
			</div>
			<div class="clearfix" style="margin-bottom: 10px;"></div>
			<div class="row">
				<div class="col-xs-2 col-md-2 text-right">
					<label for="lxdh">联系电话：</label>
				</div>
				<div class="col-xs-10 col-md-10" style="float: left">
					<input type="tel" th:value="${stu.lxdh}" maxlength="11" class="bg-success"
						id="contactnumber" name="lxdh" placeholder="请输入联系电话"
						value="" onkeyup="this.value=this.value.replace(/\D/g,'')" />
				</div>
			</div>
			<div class="clearfix" style="margin-bottom: 10px;"></div>
			<div class="row">
				<div class="col-xs-2 col-md-2 text-right">
					<label>户口类别：</label>
				</div>
				<div class="col-xs-10 col-md-10" style="float: left">
					<div class="btn-group" data-toggle="buttons">
						<label
							class="btn btn-success" th:class="${stu.hklb}=='2'?'btn btn-success active':'btn btn-success'"> <input type="radio" name="hklb"
							id="hklb1" value="2"> 城镇
						</label> <label
							class="btn btn-success"  th:class="${stu.hklb}=='1'?'btn btn-success active':'btn btn-success'"> <input type="radio" name="hklb"
							id="hklb2" value="1"> 农村
						</label>
					</div>
				</div>
			</div>
			<div class="clearfix" style="margin-bottom: 10px;"></div>
			<div class="row">
				<div class="col-xs-2 col-md-2 text-right">
					<label>考生类型：</label>
				</div>
				<div class="col-xs10 col-md-10" style="float: left">
					<div class="btn-group" data-toggle="buttons">
						<label
							class="btn btn-success"   th:class="${stu.ddks}=='2'?'btn btn-success active':'btn btn-success'"> <input type="radio" name="ddks"
							id="ddks1" value="2"> 一类模式
						</label> <label
							class=" btn btn-success"   th:class="${stu.ddks}=='3'?'btn btn-success active':'btn btn-success'"> <input type="radio" name="ddks"
							id="ddks2" value="3"> 二类模式
						</label>
					</div>
				</div>
			</div>
			<div class="clearfix" style="margin-bottom: 10px;"></div>
			<div class="row">
				<div class="col-xs-2 col-md-2 text-right">
					<label>政治面貌：</label>
				</div>
				<div class="col-xs-10 col-md-10" style="float: left">
					<div class="btn-group" data-toggle="buttons">
						<label
							class=" btn btn-success"   th:class="${stu.zzmm}=='03'?'btn btn-success active':'btn btn-success'"> <input type="radio" name="zzmm"
							id="zzmm1" value="03">团员
						</label> <label
							class="btn btn-success"   th:class="${stu.zzmm}=='13'?'btn btn-success active':'btn btn-success'"> <input type="radio" name="zzmm"
							id="zzmm2" value="13">其他
						</label>
					</div>
				</div>
			</div>
			<div class="clearfix" style="margin-bottom: 10px;"></div>
			<div class="row">
				<div class="col-xs-2 col-md-2 text-right">
					<label>考生类别：</label>
				</div>
				<div class="col-xs-10 col-md-10" style="float: left">
					<div class="btn-group" data-toggle="buttons">
						<label
							class="btn btn-success"   th:class="${stu.kslb}=='1'?'btn btn-success active':'btn btn-success'"> <input type="radio" name="kslb"
							id="kslb1" value="1"> 初中应届
						</label> <label
							class=" btn btn-success"   th:class="${stu.kslb}=='2'?'btn btn-success active':'btn btn-success'"> <input type="radio" name="kslb"
							id="kslb2" value="2"> 初中往届
						</label>
					</div>
				</div>
			</div>
			<div class="clearfix" style="margin-bottom: 10px;"></div>
			<div class="row">
				<div class="col-xs-2 col-md-2 text-right">
					<label>加试科目：</label>
				</div>
				<div class="col-xs10 col-md-10" style="float: left">
					<div class="btn-group" data-toggle="buttons">
						<label
							class=" btn btn-success"   th:class="${stu.js}=='1'?'btn btn-success active':'btn btn-success'"> <input type="radio" name="js"
							id="jskm1" value="1">藏语文
						</label> <label
							class="btn btn-success"   th:class="${stu.js}=='2'?'btn btn-success active':'btn btn-success'"> <input type="radio" name="js"
							id="jskm2" value="2">彝语文
						</label>
						 <label
							class="btn btn-success"   th:class="${stu.js}=='3'?'btn btn-success active':'btn btn-success'"> <input type="radio" name="js"
							id="jskm3" value="3">无加试
						</label>
					</div>
				</div>
			</div>
			<div class="clearfix" style="margin-bottom: 10px;"></div>
			<div class="row" id="row5">
				<div class="col-xs-2 col-md-2 text-right">
					<label>户籍地：</label>
				</div>
				<div class="col-xs-10 col-md-10 input-group" id="element_id">
					<select  class="province" data-first-title="选择省"></select> 
					<select  class="city" data-first-title="选择市"></select> 
					<select  class="area" data-first-title="选择地区"></select>
					<select name="hjd" class="street" data-first-title="选择乡镇街道"></select>
				</div>
			</div>	
			<div class="row" id="sub">
				<div class="col-xs-12 col-md-12">
<button id="upload" class="btn btn-primary btn-block" onclick="formSubmit();" type="button">提交</button>
				</div>
			</div>
		</div>
	</form>
</body>
<script src="../js/gVerify.js"></script>
<script src="../js/commen.js"></script>
<script>
</script>
<script>
function is_submit(value) {
    var form1 = $("#signup");
    if (value == 1) {    	//	返回上级
        var id = $("#id").val();
        form1.action = "check";
         $("#signup").attr("action","showManagerSignUpInfo");
        form1.submit();
    }
    if (value == 2) {	//安全退出
        form1.action = "logout";
        $("#signup").attr("action", "/city/logout");
        form1.submit();

    }
   
}

/**
 * 提交按钮点击事件
 */
function formSubmit(){
	//	非空验证
	/* if($("input[name=xm]").val()==""){
		alert("请输入学生姓名！");$("input[name=xm]").focus();return;
	}
	
	var sfzh = $("input[name=sfzh]").val();
	var reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;  //	验证身份证号码的正则表达式
	if(sfzh==""){
		alert("请输入身份证号码！");$("input[name=sfzh]").focus();return;
	}
	if(reg.test(sfzh)===false){
		alert("身份证号码格式错误！");$("input[name=sfzh]").focus();return;
	}
	//18位身份证需要验证最后一位校验位
	if (sfzh.length == 18) {
		sfzh = sfzh.split('');
		//∑(ai×Wi)(mod 11)
		//加权因子
		var factor = [ 7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2 ];
		//校验位
		var parity = [ 1, 0, 'X', 9, 8, 7, 6, 5, 4, 3, 2 ];
		var sum = 0;
		var ai = 0;
		var wi = 0;
		for (var i = 0; i < 17; i++) {
			ai = sfzh[i];
			wi = factor[i];
			sum += ai * wi;
		}
		var last = parity[sum % 11];
		if (parity[sum % 11] != (sfzh[17]=='x'?'X':sfzh[17])) {
			alert("身份证校验位错误！");
			$("input[name=sfzh]").focus();
			return;
		}
		sfzh = sfzh.toString().replace(/,/g,"")
	}
	
	if($("input[name=xjh]").val()==""){
		alert("请输入学籍号！");$("input[name=xjh]").focus();return;
	}
	
	if($("input[name=byzxdm]").val()==""){
		alert("请输入学校名称！");$("input[name=byzxdm]").focus();return;
	}
	
	if($("input[name=bjdm]").val()==""){
		alert("请输入班级名称！");$("input[name=bjdm]").focus();return;
	} */

	if($("input[name=yzbm]").val()==""){
		alert("请输入邮政编码！");$("input[name=yzbm]").focus();return;
	}
	
	if($("input[name=txdz]").val()==""){
		alert("请输入通讯地址！");$("input[name=txdz]").focus();return;
	}
	
	if($("input[name=lxdh]").val()==""){
		alert("请输入电话号码！");$("input[name=lxdh]").focus();return;
	}
	
	reg = /^1[3456789]\d{9}$/;	//	正则表达式 验证电话号码
	if(reg.test($("input[name=lxdh]").val())===false){
		alert("电话号码输入错误！");$("input[name=lxdh]").focus();return;
	}
	
	if(!$("#hklb1").parent('label').hasClass("active") && !$("#hklb2").parent('label').hasClass("active")){
		alert("请选择户口类别！");return;
	}
	
	if(!$("#ddks1").parent('label').hasClass("active") && !$("#ddks2").parent('label').hasClass("active")){
		alert("请选择考生类型！");return;
	}
	
	if(!$("#zzmm1").parent('label').hasClass("active") && !$("#zzmm2").parent('label').hasClass("active")){
		alert("请选择政治面貌！");return;
	}
	
	if(!$("#kslb1").parent('label').hasClass("active") && !$("#kslb2").parent('label').hasClass("active")){
		alert("请选择考生类别！");return;
	}
	
	if(!$("#jskm1").parent('label').hasClass("active") && !$("#jskm2").parent('label').hasClass("active") && !$("#jskm3").parent('label').hasClass("active")){
		alert("请选择加试科目！");return;
	}
	
	if(!$(".street").val() || $(".street").val()==""){
		alert("请选择户籍地！");return;
	}
	
	//	提交
	$("#signup").submit();
}
	/*户籍地联动*/
	$.cxSelect.defaults.url = "../js/pcas-code.json";
	$("#element_id").cxSelect({
		selects : [ 'province', 'city', 'area', 'street' ],
		jsonName : 'n',
		jsonValue : 'v',
		nodata : 'none'
	});

	$.cxSelect.defaults.nodata = 'none';
	/* 	var hjds = $("#hjd").val();
	 if (!hjds) {
	 hjds = hjds.split(',');
	 for (var i = 0; i < hjds.length; i++) {
	 alert();
	 console.log(i);
	 $(".hjd")[i].attr("data-value", hjds[i]);
	 }
	 } */
	 var nations = [{"code":"20","value":"傈僳族"},{"code":"21","value":"佤族"},{"code":"04","value":"藏族"},{"code":"05","value":"维吾尔族"},{"code":"22","value":"畲族"},{"code":"46","value":"德昂族"},{"code":"47","value":"保安族"},{"code":"06","value":"苗族"},{"code":"07","value":"彝族"},{"code":"23","value":"高山族"},{"code":"08","value":"壮族"},{"code":"09","value":"布依族"},{"code":"01","value":"汉族"},{"code":"02","value":"蒙古族"},{"code":"03","value":"回族"},{"code":"10","value":"朝鲜族"},{"code":"11","value":"满族"},{"code":"12","value":"侗族"},{"code":"13","value":"瑶族"},{"code":"14","value":"白族"},{"code":"15","value":"土家族"},{"code":"16","value":"哈尼族"},{"code":"17","value":"哈萨克族"},{"code":"18","value":"傣族"},{"code":"19","value":"黎族"},{"code":"24","value":"拉祜族"},{"code":"25","value":"水族"},{"code":"26","value":"东乡族"},{"code":"27","value":"纳西族"},{"code":"28","value":"景颇族"},{"code":"29","value":"柯尔克孜族"},{"code":"30","value":"土族"},{"code":"31","value":"达斡尔族"},{"code":"32","value":"仫佬族"},{"code":"33","value":"羌族"},{"code":"34","value":"布朗族"},{"code":"35","value":"撒拉族"},{"code":"36","value":"毛难族"},{"code":"37","value":"仡佬族"},{"code":"38","value":"锡伯族"},{"code":"39","value":"阿昌族"},{"code":"40","value":"普米族"},{"code":"41","value":"塔吉克族"},{"code":"42","value":"怒族"},{"code":"43","value":"乌孜别克族"},{"code":"44","value":"俄罗斯族"},{"code":"45","value":"鄂温克族"},{"code":"48","value":"裕固族"},{"code":"49","value":"京族"},{"code":"50","value":"塔塔尔族"},{"code":"51","value":"独龙族"},{"code":"52","value":"鄂伦春族"},{"code":"53","value":"赫哲族"},{"code":"54","value":"门巴族"},{"code":"55","value":"珞巴族"},{"code":"56","value":"基诺族"}]
		     var nation = $("select[id=mz]");
		     for ( var i=0;i<nations.length;i++) {
		         var a=nations[i];
		         nation.append("<option value="+nations[i].code+">"+nations[i].value+"</option>");
		     }
		 
		 /**
		 根据身份证号码得到出生日期
		 */
		 function getCsrq(obj){
			 var sfzh = $("input[name=sfzh]").val();
				var reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;  //	验证身份证号码的正则表达式
				if(sfzh==""){
					alert("请输入身份证号码！");$("input[name=sfzh]").focus();return;
				}
				if(reg.test(sfzh)===false){
					alert("身份证号码格式错误！");$("input[name=sfzh]").focus();return;
				}
				//18位身份证需要验证最后一位校验位
				if (sfzh.length == 18) {
					sfzh = sfzh.split('');
					//∑(ai×Wi)(mod 11)
					//加权因子
					var factor = [ 7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2 ];
					//校验位
					var parity = [ 1, 0, 'X', 9, 8, 7, 6, 5, 4, 3, 2 ];
					var sum = 0;
					var ai = 0;
					var wi = 0;
					for (var i = 0; i < 17; i++) {
						ai = sfzh[i];
						wi = factor[i];
						sum += ai * wi;
					}
					var last = parity[sum % 11];
					if (parity[sum % 11] != (sfzh[17]=='x'?'X':sfzh[17])) {
						alert("身份证校验位错误！");
						$("input[name=sfzh]").focus();
						return;
					}
					sfzh = sfzh.toString().replace(/,/g,"")
				}
				
				var csrq = "";
				 if(sfzh.length == 15){  
					 csrq = "19"+sfzh.substr(6,6);  
		            } else if(sfzh.length == 18){  
		            	csrq = sfzh.substr(6,8);  
		            }
		          
				 //csrq = csrq.replace(/(.{4})(.{2})/,"$1-$2-");  
				 $("input[name='csrq']").val(csrq);
		 }
</script>

<script type="text/javascript" th:inline="javascript">

    var mz = [[${stu.mz}]];
$("#mz").val(mz);
var hjd = [[${stu.hjd}]];
if(hjd.length>=2){
	$(".province").attr("data-value",hjd.substring(0,2));
}
if(hjd.length>=4){
	$(".city").attr("data-value",hjd.substring(0,4));
}
if(hjd.length>=6){
	$(".area").attr("data-value",hjd.substring(0,6));
}
if(hjd.length>=9){
	$(".street").attr("data-value",hjd.substring(0,9));
}
</script>

</html>
